package com.dxx.D201910312055.dxx;


import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.view.accessibility.AccessibilityEvent;

import static com.dxx.D201910312055.dxx.AutoService.mService;

public abstract class AutoAbstract {

    /**
     * 在
     */
    //      初始化
    public abstract void onStart();


    //        在运行的
    public abstract void onRun(AccessibilityEvent event);

    //停止
    public abstract void onStop();

    /**
     * 检查包是否存在
     *
     * @param packname
     * @return
     */
    public static boolean checkPackInfo(String packname) {
        PackageInfo packageInfo = null;
        try {
            packageInfo = mService.getPackageManager().getPackageInfo(packname, 0);
        } catch (PackageManager.NameNotFoundException e) {
//            e.printStackTrace();
        }
        return packageInfo != null;
    }


//            out.println( mService.getRootInActiveWindow().findAccessibilityNodeInfosByViewId("com.jm.video:id/textFoot").isEmpty() );
//            out.println( mService.getRootInActiveWindow().findAccessibilityNodeInfosByText("正在加载...").isEmpty() );
//            out.println(  Utils.mPerformAction(mService.getRootInActiveWindow(), "android.widget.ProgressBar",0) );
//        mPerformAction(event.getSource());


}
